package com.swanclouds.redfish.managers;

import com.swanclouds.api.managers.NetworkProtocolService;
import com.swanclouds.core.transport.ClientConstants;
import com.swanclouds.model.managers.NetworkProtocol;
import com.swanclouds.redfish.internal.BaseManagerService;
import com.swanclouds.redfish.managers.domain.NetworkProtocolModel;
import com.swanclouds.redfish.managers.domain.UpdateNetworkProtocol;

public class NetworkProtocolServiceImpl extends BaseManagerService implements NetworkProtocolService {

    /**
     * 查询BMC服务详情信息
     * @return NetworkProtocol
     */
    @Override
    public NetworkProtocol get() {
        return get(NetworkProtocolModel.class,uri(ClientConstants.PATH_MANAGERS_NETWORKPROTOCOL,getManagerId())).execute();
    }

    /**
     * 修改BMC服务信息
     * @param updateNetworkProtocol 参数
     * @return NetworkProtocol
     */
    @Override
    public NetworkProtocol updateNepWorkProtocol(UpdateNetworkProtocol updateNetworkProtocol) {
        //操作之前先进行查询,确保获取到的if-Match是最新的
        //get();
        return patch(NetworkProtocolModel.class,uri(ClientConstants.PATH_MANAGERS_NETWORKPROTOCOL,getManagerId()))
                .entity(updateNetworkProtocol)
                .execute();
    }
}
